package net.java.fixrouter;

import java.io.InputStream;
import java.io.IOException;
import java.nio.ByteBuffer;

/**
 * @author Leonid Shlyapnikov
 */
public class ByteBufferInputStream extends InputStream {

    private ByteBuffer buffer;

    public void feed(ByteBuffer buffer) {
        this.buffer = buffer;
    }

    public int read() throws IOException {
        if (null == buffer) {
            throw new IllegalStateException("buffer is null!");
        }

        if (buffer.remaining() == 0) {

        }


        return buffer.get();
    }
}
